//
//  CocoaClavier.m
//  Metronome
//
//  Created by Pierre DUCHÊNE on 29/09/09.
//  Copyright 2009 GreenTeam. All rights reserved.
//

#import "CocoaClavier.h"


@implementation CocoaClavier

#pragma mark -
#pragma mark Clavier Protocol Implementation
- (BOOL)touchePresse:(NSUInteger)numeroTouche
{
	BOOL result = NO;
	switch (numeroTouche) {
		case 1:
			result = isStartButtonDidPush;
			isStartButtonDidPush = NO;
			break;
		case 2:
			result = isStopButtonDidPush;
			isStopButtonDidPush = NO;
			break;
		case 3:
			result = isIncButtonDidPush;
			isIncButtonDidPush = NO;
			break;
		case 4:
			result = isDecButtonDidPush;
			isDecButtonDidPush = NO;
			break;
		default:
			break;
	}
	return result;
}

#pragma mark -
#pragma mark Internal Methods

- (void)awakeFromNib
{
	isIncButtonDidPush = NO;
	[stopButton setEnabled:NO];
}
- (IBAction)start:(id)sender
{
	isStartButtonDidPush = YES;
	[startButton setEnabled:NO];
	[stopButton setEnabled:YES];
}
- (IBAction)stop:(id)sender
{
	isStopButtonDidPush = YES;
	[startButton setEnabled:YES];
	[stopButton setEnabled:NO];
}
- (IBAction)inc:(id)sender
{
	isIncButtonDidPush = YES;
}
- (IBAction)dec:(id)sender
{
	isDecButtonDidPush = YES;
}

@end
